package com.sg.service.biz.pbff.impl;

import com.sg.common.util.RedisUtil;
import com.sg.dto.biz.pbff.req.BffJudgeTargetIsReviseDataReqDto;
import com.sg.dto.biz.pbff.res.BffJudgeTargetIsReviseDataRespDto;
import com.sg.dto.integration.app.JudgeTargetIsReviseDataReqDto;
import com.sg.dto.integration.app.JudgeTargetIsReviseDataRespDto;
import com.sg.service.biz.pbff.EvaSystemService;
import com.wicket.okrapp.integration.EvaSystemService;
import com.sg.common.exception.Assert;
import org.apache.skywalking.apm.toolkit.trace.Tag;
import org.apache.skywalking.apm.toolkit.trace.Tags;
import org.apache.skywalking.apm.toolkit.trace.Trace;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Service
public class EvaSystemServiceImpl implements EvaSystemService {

    @Resource
    private RedisUtil redisUtil;
    @Resource
    com.sg.service.biz.app.EvaSystemService fwAppEvaSystemClient;

    /**
     * B3判断指标是否存在修订(管理)[5230]
     * gen by moon at 11/18/2022, 7:34:56 PM
     */
    @Trace(operationName = "B3判断指标是否存在修订(管理)")
    @Tags({@Tag(key = "参数", value = "arg[0]"),
            @Tag(key = "返回值", value = "returnedObj")})
    @Override
    public BffJudgeTargetIsReviseDataRespDto judgeTargetIsReviseData(BffJudgeTargetIsReviseDataReqDto reqDto) {


        JudgeTargetIsReviseDataRespDto judgeTargetIsReviseDataRespDto_1 = null;
//步骤0: D3判断指标是否存在修订 - judgeTargetIsReviseData
        JudgeTargetIsReviseDataRespDto judgeTargetIsReviseDataRespDto = null;
        JudgeTargetIsReviseDataReqDto judgeTargetIsReviseDataReqDto = new JudgeTargetIsReviseDataReqDto();
        if (reqDto != null) {
            judgeTargetIsReviseDataReqDto.setUndoReviseReviseTargetData(reqDto.getUndoReviseReviseTargetData());//SimpleFieldAssign//sourceId:442640_1
            judgeTargetIsReviseDataReqDto.setEntityId(reqDto.getEntityId());//SimpleFieldAssign//sourceId:442641_1
            judgeTargetIsReviseDataReqDto.setEvaObjTypeCode(reqDto.getEvaObjTypeCode());//SimpleFieldAssign//sourceId:442642_1
            judgeTargetIsReviseDataReqDto.setEvaluationTemplateId(reqDto.getEvaluationTemplateId());//SimpleFieldAssign//sourceId:442643_1
        }

        /*D3判断指标是否存在修订[5231]   */
        Assert.isNull(judgeTargetIsReviseDataReqDto.getUndoReviseReviseTargetData(), "B3判断指标是否存在修订(管理)-D3判断指标是否存在修订-撤销修订指标相关信息不能为空", false);
        Assert.isNull(judgeTargetIsReviseDataReqDto.getEntityId(), "B3判断指标是否存在修订(管理)-D3判断指标是否存在修订-冗余内容表主键ID不能为空", false);
        Assert.isNull(judgeTargetIsReviseDataReqDto.getEvaObjTypeCode(), "B3判断指标是否存在修订(管理)-D3判断指标是否存在修订-被评对象类型编码不能为空", false);
        Assert.isNull(judgeTargetIsReviseDataReqDto.getEvaluationTemplateId(), "B3判断指标是否存在修订(管理)-D3判断指标是否存在修订-评价模板ID不能为空", false);
        judgeTargetIsReviseDataRespDto = fwAppEvaSystemClient.judgeTargetIsReviseData(judgeTargetIsReviseDataReqDto).getData();


        judgeTargetIsReviseDataRespDto_1 = judgeTargetIsReviseDataRespDto;

        BffJudgeTargetIsReviseDataRespDto retData = new BffJudgeTargetIsReviseDataRespDto();
        if (judgeTargetIsReviseDataRespDto_1 != null) {
            retData.setOutputNum(judgeTargetIsReviseDataRespDto_1.getOutputNum());//SimpleFieldAssign//sourceId:442649_1
        }


        return retData;
    }
    //
}
